package com.x.controller;

import com.x.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

import java.util.List;

/**
 * ClassName: UserController
 * Package: IntelliJ IDEA
 * Description:
 * 根据不同的业务需求，设计不同的请求方式及其路径
 * Written by HanXu
 * Create 2024.09.13 9:13
 */

@ResponseBody
@Controller
@RequestMapping("user")
public class UserController {

    @GetMapping
    public List<User> page(@RequestParam(required = false, defaultValue = "1") int page,
                           @RequestParam(required = false, defaultValue = "10")int size){
        return null;
    }

    @PostMapping
    public User save(@RequestBody User user){
        return user;
    }

    @GetMapping("{id}")
    public User getInfo(@PathVariable("id") int id){
        User user = new User();
        user.setId(id);
        return user;
    }
}
